package com.example.mytestdemo.scale;

import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

import com.example.mytestdemo.BaseViewBindActivity;
import com.example.mytestdemo.R;
import com.example.mytestdemo.databinding.ActivityScaleLayoutBinding;

/**
 * @author tgw
 * @date 2022/9/13
 * @describe
 */
public class ScaleViewActivity extends BaseViewBindActivity<ActivityScaleLayoutBinding> {


    @Override
    public int getLayoutInflateId() {
        return R.layout.activity_scale_layout;
    }

    @Override
    public void initData() {
//        mBind.scaleView.post(new Runnable() {
//            @Override
//            public void run() {
//                mBind.scaleView.postInvalidate();
//            }
//        });
    }

    @Override
    public void initUI() {
        mBind.tvRotation.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mBind.scaleView.doSetCWRotation();
            }
        });
        mBind.tvAddScale.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mBind.scaleView.setAddScale(0.2f);
            }
        });
        mBind.tvReduceScale.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mBind.scaleView.setReduceScale(0.2f);
            }
        });
//        mBind.scaleView.setOnTouchListener(new View.OnTouchListener() {
//            @Override
//            public boolean onTouch(View v, MotionEvent event) {
//                Log.d(TAG, "tgw onTouch: "+v.getX()+"---"+v.getY());
//                return true;
//            }
//        });
    }
}
